# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : quick_sort.py
# @Time     : 2024/1/30 20:43
# @Author   : Robot-Zsj
"""
description: 
"""


def quick_sort(nums):
    recursion(nums, 0, len(nums) - 1)
    return nums


def recursion(nums, low, high):
    if low >= high:
        return
    i = low
    j = high
    key = nums[i]
    while i < j:
        while i < j and key <= nums[j]:
            j -= 1
        nums[i] = nums[j]
        while i < j and key >= nums[i]:
            i += 1
        nums[j] = nums[i]
    nums[i] = key
    recursion(nums, low, i - 1)
    recursion(nums, i + 1, high)


print(quick_sort([50, 36, 66, 76, 95, 12, 25]))
